package com.springboot.erp;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.erp.entity.JshSupplier;
import com.springboot.erp.mapper.JshSupplierMapper;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
@Slf4j
public class testapplication {
    @Resource
private JshSupplierMapper jshSupplierMapper;

    @Test
    public  void testselectForPagesC() {
        Page<JshSupplier> page = new Page<>(1, 5);
        OrderItem orderItem =  OrderItem.desc("id");
        page.addOrder(orderItem);
        Page<JshSupplier> page2 =jshSupplierMapper.selectForPagesSupC("客户3",null ,
                null  , page);
        log.info("total:{}", page2.getPages());
        log.info("total:{}", page2.getTotal());
        log.info("current:{}", page2.getCurrent());
        log.info("size:{}", page2.getSize());
        log.info("records:{}", page2.getRecords());


    }
 @Test
    public void testselectForPages() {
        Page<JshSupplier> page = new Page<>(1, 5);
        OrderItem orderItem =  OrderItem.desc("id");
        page.addOrder(orderItem);
        Page<JshSupplier> page2 =jshSupplierMapper.selectForPagesSup("客户3",null ,
                null  , page);
        log.info("total:{}", page2.getPages());
        log.info("total:{}", page2.getTotal());
        log.info("current:{}", page2.getCurrent());
        log.info("size:{}", page2.getSize());
        log.info("records:{}", page2.getRecords());


    }
    @Test
    public void testinsertOne() {
        JshSupplier jshSupplier = new JshSupplier();
        jshSupplier.setSupplier("test5");
        jshSupplier.setPhoneNum("123456789");
        jshSupplier.setTelephone("123456789");
        jshSupplierMapper.insrtONeSup(jshSupplier);
    }
    @Test
    public void testupdateOne() {
        JshSupplier jshSupplier = new JshSupplier();
        jshSupplier.setId(92);
        jshSupplier.setSupplier("test");
        jshSupplier.setPhoneNum("12345678");
        jshSupplier.setTelephone("12345678");
        jshSupplierMapper.updateOneSup(jshSupplier);
    }
@Test
    public void testdeleteOne() {
    jshSupplierMapper.deleteOneSup(93);}



}
